/**
 * Created by vincent on 2017/10/12.
 */
moduleStudyMap.controller("AddEventController", function ($$CambioConfig, $scope, $log, $state, LoadingService, EnumService,
                                                          ConstantService, EventResource, DialogService) {
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.newEvent = {
        active: true
    };

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        if ($scope.addEventForm.$valid) {
            //LoadingService.show();
            EventResource.add($scope.newEvent, function (result) {
                $log.debug("活动新增结果", result);
                DialogService.close();
                Alert.success("活动勋章成功！");
                //LoadingService.hide();
            });
        }
    };
});